<template>
  <div id="app">
    <p>{{ age }}</p>
    <p>{{ count }}</p>
    <button @click="addAge()">点击添加年龄</button>
  </div>
</template>

<script>

export default {
  name: 'App',
  computed: {
    age() {
      return this.$store.state.age
    },
    count() {
      return this.$MyStore.state.count
    }
  },
  methods: {
    addAge() {
      // this.$MyStore.dispatch('asyncIncrement', 1000)
      // this.$store.commit('increment', this.age + 1)
      // this.$MyStore.state.count = 222222
       this.$MyStore.commit('increment', this.count + 1)
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
